home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 60 / IOPROG_60.ISO / soft / c++ / gsl-1.1.1-setup.exe / {app} / src / cblas / source_rotm.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-05-14  |  1.5 KB  |  59 lines

  1. /* blas/source_rotmg.h
  2.  * 
  3.  * Copyright (C) 1996, 1997, 1998, 1999, 2000 Brian Gough
  4.  * 
  5.  * This program is free software; you can redistribute it and/or modify
  6.  * it under the terms of the GNU General Public License as published by
  7.  * the Free Software Foundation; either version 2 of the License, or (at
  8.  * your option) any later version.
  9.  * 
  10.  * This program is distributed in the hope that it will be useful, but
  11.  * WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.  * General Public License for more details.
  14.  * 
  15.  * You should have received a copy of the GNU General Public License
  16.  * along with this program; if not, write to the Free Software
  17.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  */
  19.  
  20. {
  21.   INDEX n;
  22.   INDEX i = OFFSET(N, incX);
  23.   INDEX j = OFFSET(N, incY);
  24.  
  25.   BASE h11, h21, h12, h22;
  26.  
  27.   if (P[0] == -1.0) {
  28.     h11 = P[1];
  29.     h21 = P[2];
  30.     h12 = P[3];
  31.     h22 = P[4];
  32.   } else if (P[0] == 0.0) {
  33.     h11 = 1.0;
  34.     h21 = P[2];
  35.     h12 = P[3];
  36.     h22 = 1.0;
  37.   } else if (P[0] == 1.0) {
  38.     h11 = P[1];
  39.     h21 = -1.0;
  40.     h12 = 1.0;
  41.     h22 = P[4];
  42.   } else if (P[0] == -2.0) {
  43.     return;
  44.   } else {
  45.     BLAS_ERROR("unrecognized value of P[0]");
  46.     return;
  47.   }
  48.  
  49.   for (n = 0; n < N; n++) {
  50.     const BASE w = X[i];
  51.     const BASE z = Y[j];
  52.     X[i] = h11 * w + h12 * z;
  53.     Y[j] = h21 * w + h22 * z;
  54.     i += incX;
  55.     j += incY;
  56.   }
  57.  
  58. }
  59.